#!/usr/bin/python3
#! -*- coding:utf-8 -*-

import random
from caltime import runtime


@runtime
def select_sort(ls):
    for i in range(len(ls) - 1):  # 循环
        min_loc = i  # 把i记为最小的数的下标
        for j in range(i + 1, len(ls)):  # 从i后面的数开始循环
            if ls[j] < ls[min_loc]:
                min_loc = j
        ls[i], ls[min_loc] = ls[min_loc], ls[i]


lst = [random.randint(-100, 100) for _ in range(10)]
print('原列表>>>', lst)
select_sort(lst)
print('排序后的列表>>>', lst)

